home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / devices / src / closedevice.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.6 KB  |  79 lines

  1. /*
  2.     (C) 1995, 96 AROS - The Amiga Replacement OS
  3.     $Id$
  4.     $Log$
  5.     Desc:
  6.     Lang: english
  7. */
  8. #include "exec_intern.h"
  9. #include <exec/io.h>
  10. #include <dos/dos.h>
  11. #include <aros/libcall.h>
  12.  
  13. /*****************************************************************************
  14.  
  15.     NAME */
  16.     #include <clib/exec_protos.h>
  17.  
  18.     __AROS_LH1(void, CloseDevice,
  19.  
  20. /*  SYNOPSIS */
  21.     __AROS_LA(struct IORequest *, iORequest, A1),
  22.  
  23. /*  LOCATION */
  24.     struct ExecBase *, SysBase, 75, Exec)
  25.  
  26. /*  FUNCTION
  27.     Closes a previously opened device. Any outstanding I/O requests must
  28.     be finished. It is safe to call CloseDevice with a cleared iorequest
  29.     structure or one that failed to open.
  30.  
  31.     INPUTS
  32.     iORequest - Pointer to iorequest structure.
  33.  
  34.     RESULT
  35.  
  36.     NOTES
  37.  
  38.     EXAMPLE
  39.  
  40.     BUGS
  41.  
  42.     SEE ALSO
  43.     OpenDevice().
  44.  
  45.     INTERNALS
  46.  
  47.     HISTORY
  48.  
  49. ******************************************************************************/
  50. {
  51.     __AROS_FUNC_INIT
  52.  
  53.     /* Single-thread the close routine. */
  54.     Forbid();
  55.  
  56.     /* Something to do? */
  57.     if(iORequest->io_Device!=NULL)
  58.     {
  59.     (void) __AROS_LC1 (LONG, closeDevice,
  60.         __AROS_LCA(struct IORequest *, iORequest, A1),
  61.         struct Device *, iORequest->io_Device, 2, Device);
  62.     /*
  63.         Normally you'd expect the device to be expunged if this returns
  64.         non-zero, but this is only exec which doesn't know anything about
  65.         seglists - therefore dos.library has to SetFunction() into this
  66.         vector for the additional functionality.
  67.     */
  68.  
  69.     /* Trash device field */
  70.     iORequest->io_Device=(struct Device *)-1;
  71.     }
  72.  
  73.     /* All done. */
  74.     Permit();
  75.  
  76.     __AROS_FUNC_EXIT
  77. } /* CloseDevice */
  78.  
  79.